package net.keso.ted.fckeditor;

import org.apache.tapestry.ioc.Configuration;
import org.apache.tapestry.ioc.MappedConfiguration;
import org.apache.tapestry.ioc.annotations.Symbol;
import org.apache.tapestry.services.LibraryMapping;

public class FckEditorModule
{
	
    public static void contributeFactoryDefaults(MappedConfiguration<String, String> configuration)
    {
        // This is designed to make it easy to keep syncrhonized with FCKeditor. As we
        // support a new version, we create a new folder, and update the path entry. We can then
        // delete the old version folder (or keep it around). This should be more manageable than
        // ovewriting the local copy with updates. There's also a ClasspathAliasManager
        // contribution based on the path.

        configuration.add("net.keso.ted.fckeditorscript", "classpath:${net.keso.ted.fckeditorscript.path}");
        configuration.add("net.keso.ted.fckeditorscript.path", "net/keso/ted/fckeditor/FCKeditor_2.4.3");
    }
	
    public static void contributeClasspathAssetAliasManager(
            MappedConfiguration<String, String> configuration,
            @Symbol("net.keso.ted.fckeditorScript.path")
            String fckEditorScriptPath)
    {
        configuration.add("FCKeditor/", fckEditorScriptPath + "/");
    }
    
	public static void contributeComponentClassResolver(Configuration<LibraryMapping> configuration)
	{
		configuration.add(new LibraryMapping("fckeditor", "net.keso.ted.fckeditor"));
	}

}
